package chapter1.operator;

public class OperatorFactory {
    public static Operator createOperator(String operator){
        Operator operatorObj = null;

        switch (operator) {
            case "+" :
                operatorObj = new OperatorPlus();
                break;
            case "-" :
                operatorObj = new OperatorMinus();
                break;
            case "*" :
                operatorObj = new OperatorMultiply();
                break;
            case "/" :
                operatorObj = new OperatorDivide();
                break;
        }

        return operatorObj;
    }
}
